package ink.ykb.droolstest.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import ink.ykb.droolstest.config.ResponseMsg;
import ink.ykb.droolstest.drools.dto.QudaoRetaReq;
import ink.ykb.droolstest.entity.Qishu;
import ink.ykb.droolstest.entity.Qudao;
import ink.ykb.droolstest.entity.Qudaoluyou;
import ink.ykb.droolstest.entity.Shanghu;
import ink.ykb.droolstest.entity.Yinhang;
import ink.ykb.droolstest.service.QdpzService;
import ink.ykb.droolstest.service.dto.QudaoluyouDto;

@RestController
@RequestMapping("/qdpz")
public class QdpzController {
	
	@Autowired
	private QdpzService qdpzService;
	
	@RequestMapping("/add")
	public ResponseMsg<String> addQudaoluyou(Qudaoluyou qudaoluyou) {
		qdpzService.addQudaoluyou(qudaoluyou);
		return new ResponseMsg(ResponseMsg.CODE_SUCCESS,"添加成功");
	}
	
	@RequestMapping("/luyou")
	public ResponseMsg<QudaoluyouDto> getQudaoluyouDto(Integer id) {
		return new ResponseMsg(ResponseMsg.CODE_SUCCESS,"查询成功",qdpzService.getQudaoluyouDto(id));
	}
	
	@RequestMapping("/delete")
	public ResponseMsg<String> deleteQudaoluyou(Integer id) {
		qdpzService.deleteQudaoluyou(id);
		return new ResponseMsg(ResponseMsg.CODE_SUCCESS,"删除成功");
	}
	
	@RequestMapping("/qudaoluyou/list")
	public ResponseMsg<List<QudaoluyouDto>> getQudaoluyouList() {
	    return new ResponseMsg(ResponseMsg.CODE_SUCCESS,"查询成功",qdpzService.getQudaoluyouList());
	}
	
	@RequestMapping("/qudao/list")
	public ResponseMsg<List<Qudao>> getQudaoList() {
		return new ResponseMsg(ResponseMsg.CODE_SUCCESS,"查询成功",qdpzService.getQudaoList());
	}
	
	@RequestMapping("/yinhang/list")
	public ResponseMsg<List<Yinhang>> getYinhangList() {
		return new ResponseMsg(ResponseMsg.CODE_SUCCESS,"查询成功",qdpzService.getYinhangList());
	}
	
	@RequestMapping("/qishu/list")
	public ResponseMsg<List<Qishu>> getQishuList() {
		return new ResponseMsg(ResponseMsg.CODE_SUCCESS,"查询成功",qdpzService.getQishuList());
	}
	
	@RequestMapping("/shanghu/list")
	public ResponseMsg<List<Shanghu>> getShanghuList() {
	    return new ResponseMsg(ResponseMsg.CODE_SUCCESS,"查询成功",qdpzService.getShanghuList());
	}
	
	@RequestMapping("/rate")
	public ResponseMsg<List<QudaoluyouDto>> getRate(QudaoRetaReq qudaoRetaReq) {
		return new ResponseMsg(ResponseMsg.CODE_SUCCESS,"查询成功",qdpzService.getRate(qudaoRetaReq));
	}

}
